package com.zitangkou.common.global;

import com.zitangkou.common.enums.RespEnum;
import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.util.StringUtils;

import java.io.Serializable;

/**
 * 用户实体类
 *
 * @author Deng Ningning
 * @version 1.0
 * @date 2020/8/14 17:32
 */
@Data
@Accessors(chain = true)
public class UserContent implements Serializable {

    /**
     * 用户编号
     */
    private String userId;
    /**
     * 账号
     */
    private String userAccount;
    /**
     * 密码
     */
    private String userPwd;
    /**
     * 手机号码
     */
    private String mobile;
    /**
     * 邮箱
     */
    private String email;
    /**
     * 企业编号
     */
    private String enterpriseId;

    public String getEnterpriseIdNotNull() {
        if (StringUtils.isEmpty(this.enterpriseId)) {
            throw new GlobalException(RespEnum.AUTHORITY_FAIL);
        }
        return this.enterpriseId;
    }

    public String getUserIdNotNull() {
        if (StringUtils.isEmpty(this.userId)) {
            throw new GlobalException(RespEnum.AUTHORITY_FAIL);
        }
        return this.userId;
    }
}
